import 'dart:io';

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:intl/date_symbol_data_local.dart';

import 'common/const/app_color_const.dart';
import 'common/util/common_util.dart';
import 'router_table.dart';

void main() {
  if (Platform.isAndroid) {
    SystemChrome.setSystemUIOverlayStyle(
        const SystemUiOverlayStyle(statusBarColor: Colors.transparent));
  }

  initializeDateFormatting();

  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  static final GlobalKey<NavigatorState> navigatorKey =
      GlobalKey<NavigatorState>();

  const MyApp({Key? key}) : super(key: key);

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      navigatorKey: navigatorKey,
      title: CommonUtil.getEnvConfig()["appName"],
      theme: ThemeData(
          primaryColor: primaryColor,
          primarySwatch: primaryColor,
          scaffoldBackgroundColor:appScaffoldBgColor,
          appBarTheme: const AppBarTheme(
              centerTitle: true,
              toolbarHeight: 50,
              actionsIconTheme: IconThemeData(color: appBarActIconColor),
              backgroundColor: appBarBg,
              foregroundColor: appBarFg,
              shadowColor: appBarShadowColor)),
      navigatorObservers: [FlutterSmartDialog.observer],
      builder: FlutterSmartDialog.init(),
      home: RouterTable.homePage,
      onGenerateRoute: RouterTable.onGenerateRoute,
    );
  }
}
